var domChess = document.querySelector('.container .chesscontainer');
var isGameOver = false;
var tdw = domChess.clientWidth / 14;
var halfTdw = tdw / 2;

function createChessLayout() {
  var chessHtml = '<tbody>';
  for (let i = 0; i < 14; i++) {
    chessHtml += `<tr>`;
    for (let j = 0; j < 14; j++) {
      chessHtml += `<td data-row=${i} data-line=${j}></td>`;
    }
    chessHtml += `</tr>`;
  }
  chessHtml += `</tbody>`;
  domChess.innerHTML = chessHtml;
}

function bindEvent() {
  domChess.addEventListener('click', function (e) {
    if (isGameOver) {
    } else {
      var target = e.target;
      var tempInfo = Object.assign({}, target.dataset);

      if (target.tagName === 'TD') {
        var pointX = e.offsetX > halfTdw;
        var pointY = e.offsetY > halfTdw;
        //组装点击信息
        var point
      }
    }
  });
}

function init() {
  createChessLayout();
  bindEvent();
}

init();
